package thread;

public class ATM {
    private double money = 1000;
    public void get(String name,double money) throws InterruptedException {
        synchronized (ATM.class){
            System.out.println(name + "取款，当前余额为：" + this.money);
            System.out.println("正在取款中...");
            Thread.sleep(1000);
            this.money -= money;
            System.out.println(name + "取款成功，余额为：" + this.money);
        }

    }
}
